﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FTBS.Models.DAO;
using FTBS.Models.Entities;
using FTBS.Models.Entities.Concert;

namespace FTBS.Models.BLO
{
    public class TicketCartBLO
    {
        private TicketCartDAO _ticketCartDao = new TicketCartDAO();

        /// <summary>
        /// Get all ticketcart
        /// </summary>
        /// <returns>List of TicketCartConcertEntity</returns>
        /// <author>VuongVT</author>
        public List<TicketCartConcertEntity> GetAllTicketCart()
        {
            return _ticketCartDao.GetAllTicketCart();
        }

        /// <summary>
        /// Get all ticketcart is not paid
        /// </summary>
        /// <returns></returns>
        /// <author>VuongVT</author>
        public List<TicketCartConcertEntity> GetAllTicketCartNotPaid()
        {
            return _ticketCartDao.GetAllTicketCartNotPaid();
        }

        /// <summary>
        /// Get payment information by cart id
        /// </summary>
        /// <param name="cartId"></param>
        /// <returns></returns>
        /// <author>VuongVT</author>
        public PaymentConcertEntity GetPaymentByCartId(string cartId)
        {
            return _ticketCartDao.GetPaymentByCartId(cartId);
        }

        /// <summary>
        /// Update a payment
        /// </summary>
        /// <param name="payment"></param>
        /// <returns></returns>
        /// <author>VuongVT</author>
        public int UpdatePayment(PaymentConcertEntity payment)
        {
            return _ticketCartDao.UpdatePayment(payment);
        }

        /// <summary>
        /// Get Payment by PaymentId
        /// </summary>
        /// <param name="paymentId"></param>
        /// <returns></returns>
        /// <author>VuongVT</author>
        public Payment GetPaymentById(int paymentId)
        {
            return _ticketCartDao.GetPaymentById(paymentId);
        }

        /// <summary>
        /// Delete a payment
        /// </summary>
        /// <param name="payment"></param>
        /// <returns></returns>
        /// <author>VuongVT</author>
        public int DeletePayment(Payment payment)
        {
            return _ticketCartDao.DeletePayment(payment);
        }

        /// <summary>
        /// Create a new payment information
        /// </summary>
        /// <param name="payment"></param>
        /// <returns></returns>
        /// <author>VuongVT</author>
        public int CreatePayment(Payment payment)
        {
            return _ticketCartDao.CreatePayment(payment);
        }

        /// <summary>
        /// Get TicketCart by CartId
        /// </summary>
        /// <param name="cartId">CartId</param>
        /// <returns>TicketCart</returns>
        /// <author>VuongVT</author>
        public TicketCart GetTicketCartByCartId(string cartId)
        {
            return _ticketCartDao.GetTicketCartByCartId(cartId);
        }

        /// <summary>
        /// Get TicketCart by CartId -> User for check order code
        /// </summary>
        /// <param name="cardId"></param>
        /// <returns>TicketCartConcertEntity</returns>
        /// <author>VuongVT</author>
        public TicketCartConcertEntity GetTicketCardIdByCartId(string cardId)
        {
            return _ticketCartDao.GetTicketCardIdByCartId(cardId);
        }

        /// <summary>
        /// get all ticket carts by user
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        /// <author>hungph</author>
        public List<TicketCart> GetAllTicketCartByUser(string user)
        {
            return _ticketCartDao.GetAllTicketCartByUser(user);
        }
    }
}